import pygame, sys, math

class Wall():
    def __init__(self, top, left,length, orientation):
        width = 1
        scale = 10
        color = (255,255,255)
        if orientation == "v":
            self.image = pygame.Surface((int(width*scale), int(length*scale)))
            self.rect = pygame.Rect(int(top*scale), int(left*scale), int(width*scale), int(length*scale))
        if orientation == "h":
            self.image = pygame.Surface((int(length*scale), int(width*scale)))
            self.rect = pygame.Rect(int(top*scale), int(left*scale), int(length*scale), int(width*scale))
        self.radius = self.rect.width/2
        self.image.fill(color)
        
    def __str__(self):
        return str(self.rect)
    
    def place():
        pos = self.rect.center
        
    def distanceToPoint(self, pt):
        x1 = self.rect.center[0]
        y1 = self.rect.center[1]
        x2 = pt[0]
        y2 = pt[1]
        
    def collide(self, other):
        if self.rect.right > other.rect.left and self.rect.left < other.rect.right:
            if self.rect.bottom > other.rect.top and self.rect.top < other.rect.bottom:
                if self.distanceToPoint(other.rect.center) < (self.radius + other.radius):
                    other.speed[0] = 0
                    other.speed[1] = 0
                    
        
        
    
